package com.xxx.demo.data.job;

import com.xxx.demo.data.job.service.DemoJobService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 定时任务
 * 定时任务规范：
 *  1. 统一继承 BaseJob
 *  2. @Scheduled 注解要添加到execute 方法上
 *  3. 每个定时任务类只完成一件单一功能
 *
 * @Author wangjing.dc@qq.com
 */
@Slf4j
@Component
public class DemoJob extends BaseJob{

	@Autowired
	private DemoJobService demoJobService;

	@Override
//	@Scheduled(cron = "${app.job.demojob}")
	void execute() throws JobExecutionException {
		demoJobService.print();
	}

}
